﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ACE.Wireless.PhoneBattery.BLL;
using ACE.Wireless.PhoneBattery.Common;
using ACE.Wireless.PhoneBattery.DataModel;
public partial class Error : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {            
            int status=Convert.ToInt32(Request.QueryString["status"]);
            switch(status)
            {
                case 403:
                    ///Forbidden resource
                    lblError.Text = "Forbidden this resource.Please contact with the administrator.";                                                
                    break;
                case 404:
                    ///not found
                    lblError.Text = "Can't find the requested resource.Please contact with the administrator.";                                                
                        
                        
                    break;
                case 500:
                    ///common error
                    lblError.Text = "An error has occured. Please contact with the administrator.";                                                                                                
                    break;
                default:
                    break;
            }
            if(Request.UrlReferrer!=null&&Request.UrlReferrer.AbsoluteUri!=Request.Url.AbsoluteUri)
                this.RegisterStartupScript("error", "<script>window.top.location='" + Request.Url.AbsoluteUri + "'</script>");
        }
    }
}
